<div class="pageContent">
    <form method="post" action="{:url('User/doMember_mobile')}" class="pageForm"
          onsubmit="return validateCallback(this, dialogAjaxDone)">
        <div class="pageFormContent" layoutH="58">
            <div class="unit">
                <label>绑定手机号：</label>
                <input id="phone" type="phone" name="phone" size="20" maxlength="20" class="required" value=""/>
                &nbsp;<input type="button" value="发送验证码" class="get" />
            </div>
            <div class="unit">
                <label>验证码：</label>
                <input id="code" type="code" name="code" size="20" maxlength="20" class="required" />
            </div>
            <div class="unit">
                <label>新手机号：</label>
                <input id="mobile" type="mobile" name="mobile" size="20" maxlength="20" class="required" value=""/>
            </div>
        </div>
        <script>
            var wait = 60;
            $('.get').click(function () {
                $phone = $('#phone').val();
                $.post('{:url("User/doCode")}',
                    {phone: $phone, register:'login'},
                    function (data) {
                        if (data.result == 1) {
                            alert(data.message);
                        } else {
                            $('.get').attr('style', 'background: #cccccc;');
                            time($('.get'));

                        }
                    }
                );
            });
            function time(o) {
                if (wait == 0) {
                    //$('.get').attr('style', 'background: #f59600;');
                    wait = 60;
                    $('.get').removeAttr("disabled");
                    o.html("获取手机验证码");
                } else {
                    $('.get').attr("disabled", true);//倒计时过程中禁止点击按钮
                    o.html("重新发送(" + wait + ")");//改变按钮中value的值
                    wait--;
                    setTimeout(function() {
                            time(o);//循环调用
                        },
                        1000)
                }
            }
        </script>
        <div class="formBar">
            <ul>
                <input type="hidden" name="user_id" value="{$user_id}">
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit">提交</button>
                        </div>
                    </div>
                </li>
                <li>
                    <div class="button">
                        <div class="buttonContent">
                            <button type="button" class="close">取消</button>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </form>
</div>

